﻿using MySql.Data.MySqlClient;
using NetBrick.Server;
using System.IO;
using System.Threading.Tasks;

namespace UniBrickServer.Utils
{
    public class DatabaseUtils
    {
        public static MySqlConnection Connection { get; private set; }

        public static void Init()
        {
            Log.Info("Starting MySQL Connection...");

            var connectionString = File.ReadAllText("database.cfg");

            Connection = new MySqlConnection
            {
                ConnectionString = connectionString
            };
            Connection.Open();

            Log.Info("Started MySQL Connection.");
        }
    }
}